package com.anyonavinfo.cpaddemo.data.weatherinfo.source;

import com.anyonavinfo.cpaddemo.data.weatherinfo.WeatherInfo;
<<<<<<< HEAD
import com.anyonavinfo.cpaddemo.data.weatherinfo.source.local.WeatherInfoLocalDataSource;
=======
>>>>>>> b56716b621890f59100a220d4c7abe0ddb29e232
import com.anyonavinfo.cpaddemo.data.weatherinfo.source.remote.WeatherInfoBean;
import com.anyonavinfo.cpaddemo.data.weatherinfo.source.remote.WeatherInfoRemoteDataSource;

/**
 * Created by ZuiC on 2017/2/3.
 */

public class WeatherInfoRepository implements WeatherInfoDataSource {

    private static WeatherInfoRepository INSTANCE = null;

    public static WeatherInfoRepository getInstance() {
        if (INSTANCE == null) {
            INSTANCE = new WeatherInfoRepository();
        }
        return INSTANCE;
    }

    private WeatherInfoRepository(){

    }

    @Override
<<<<<<< HEAD
    public void getLocalWeatherInfo(final GetLocalWeatherInfoCallBack callBack) {
        WeatherInfoLocalDataSource.getInstance().getWeatherInfo(new GetLocalWeatherInfoCallBack() {
            @Override
            public void onGetLocalWeatherInfo(WeatherInfo weatherInfo) {
                callBack.onGetLocalWeatherInfo(weatherInfo);
            }
        });
    }

    @Override
    public void saveWeatherInfo(WeatherInfo weatherInfo) {
        WeatherInfoLocalDataSource.getInstance().saveWeatherInfo(weatherInfo);
    }

    @Override
=======
>>>>>>> b56716b621890f59100a220d4c7abe0ddb29e232
    public void getWeatherInfo(String city, final GetWeatherInfoCallBack callBack) {
        WeatherInfoRemoteDataSource.getInstance().getWeatherInfo(city, new GetWeatherInfoCallBack() {
            @Override
            public void onGetWeatherInfo(WeatherInfo weatherInfo) {
                callBack.onGetWeatherInfo(weatherInfo);
            }
        });
    }
}
